<template>
  <div>
    <van-dropdown-menu active-color="#ee0a24">
      <van-dropdown-item title="综合" disabled />
      <van-dropdown-item v-model="value1" title="价格" :options="option1" @change="priceChange" />
      <van-dropdown-item v-model="value2" title="分类" :options="filterCategory" @change="categoryChange" />
    </van-dropdown-menu>
    <ProductList v-if="goodsList.length>0" :goodsList="goodsList" />
    <van-empty v-else image="search" description="您搜索的产品不存在" />
  </div>
</template>

<script>
import ProductList from "@/components/ProductList";
export default {
  props: ["goodsList", "filterCategory"],
  data() {
    return {
      value1: "",
      value2: 0,
      option1: [
        { text: "价格由高到低", value: 0 },
        { text: "价格由低到高", value: 1 },
      ],
    };
  },
  methods: {
    // 价格改变
    priceChange(value) {
      let aa = value === 0 ? "desc" : "asc";
      this.$emit("priceResearch", aa);
    },
    // 分类改变
    categoryChange(value){
      this.$emit("categoryResearch", value);
    }
  },
  components: {
    ProductList,
  },
};
</script>
 
<style lang = "less" scoped>
</style>